package com.example.hello;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class DBHelper extends SQLiteOpenHelper {
    private static final int VERSION=1;
    private static final String DB_NAME="myrate.db";
    public static final String TB_NAME="tb_rates";

   // private static final int VERSION=1;

    public DBHelper(@Nullable Context context) {
        super(context, DB_NAME, null, VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {//数据库没有的时候创建
        //初始化create table
        String sql="create table "+TB_NAME+"(id integer primary key autoincrement,curname text,currate text)";
        db.execSQL(sql);

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

        //手机中数据库版本和系统中版本号不一致的时候，更新

    }
}
